﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Contrast
{
    public partial class Form4 : Form
    {
        public Form4()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string pass = XML.read("delpass", "p.xml");
            if (pass != null)
            {
                if (pass != null && pass != this.textBox1.Text)
                {
                    MessageBox.Show("初始密码错误");
                }
                else
                {
                    if (this.textBox2.Text != textBox3.Text)
                    {
                        MessageBox.Show("两次密码不一致");
                    }
                    else
                    {
                        XML.write("delpass", this.textBox2.Text, "p.xml");
                        MessageBox.Show("保存密码成功");
                        this.Close();
                    }
                }
            }
            else
            {
                if (this.textBox1.Text != "888888")
                {
                    MessageBox.Show("初始密码错误");
                }
                else
                {
                    if (this.textBox2.Text != textBox3.Text)
                    {
                        MessageBox.Show("两次密码不一致");
                    }
                    else
                    {
                        XML.write("delpass", this.textBox2.Text, "p.xml");
                        MessageBox.Show("保存密码成功");
                        this.Close();
                    }
                }
            }
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }
    }
}
